ci:
  autoupdate_schedule: weekly
  skip: [eslint, prettier, mypy]
  autofix_commit_msg: "ci: auto fixes from pre-commit.ci\n\nFor more information, see https://pre-commit.ci"
  autoupdate_commit_msg: 'ci: pre-commit autoupdate [pre-commit.ci]'
default_language_version:
  python: python3.9 # NOTE: sync with .python-version-default
exclude: '.*\.(css|js|svg)$'
repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: 'v0.2.2'
    hooks:
      - id: ruff
        alias: r
        verbose: true
        args: [--exit-non-zero-on-fix, --show-fixes, --fix]
        types_or: [python, pyi, jupyter]
      - id: ruff-format
        alias: rf
        verbose: true
        types_or: [python, pyi, jupyter]
  - repo: local
    hooks:
      - id: mypy
        name: mypy
        language: system
        always_run: true
        pass_filenames: false
        entry: mypy --strict
  - repo: https://github.com/editorconfig-checker/editorconfig-checker.python
    rev: '2.7.3'
    hooks:
      - id: editorconfig-checker
        verbose: true
        alias: ec
        types_or: [python, javascript]
        exclude: |
          (?x)^(
              openllm-python/src/openllm_cli/entrypoint.py |
              openllm-client/src/openllm_client/pb.*
          )$
  - repo: meta
    hooks:
      - id: check-hooks-apply
      - id: check-useless-excludes
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.5.0
    hooks:
      - id: trailing-whitespace
        verbose: true
      - id: end-of-file-fixer
        verbose: true
      - id: check-yaml
        args: ['--unsafe']
      - id: check-toml
      - id: check-docstring-first
      - id: check-added-large-files
      - id: debug-statements
      - id: check-merge-conflict
  - repo: https://github.com/econchick/interrogate
    rev: 1.5.0
    hooks:
      - id: interrogate
        verbose: true
        types: [python]
        exclude: ^(docs|tools|openllm-python/tests)
        args: [--config=pyproject.toml]
  - repo: https://github.com/pre-commit/mirrors-eslint
    rev: v9.0.0-beta.0
    hooks:
      - id: eslint
        verbose: true
        files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
        types: [file]
  - repo: https://github.com/pre-commit/mirrors-prettier
    rev: v4.0.0-alpha.8
    hooks:
      - id: prettier
        verbose: true
        files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
        types_or: [javascript, yaml, ts]
